package 算法.排序.选择;

import util.TraverseUtils;



/**
 * 选择排序
 * @Date 2017-09-29 00：43
 */
class SelectSort {

	public void sort(int[] arr) {
		int N = arr.length;
		for (int i = 0; i < N-1; i ++) {
			for (int j = i+1; j < N; j ++) {
				if (arr[i] < arr[j]) {
					int t = arr[i];
					arr[i] = arr[j];
					arr[j] = t;
				}
			}
		}
		TraverseUtils.println(arr);
	}

	public static void main(String[] args) {
		SelectSort obj = new SelectSort();
		obj.sort(new int[] {
				3, 4, -1, 2, 7, 0, -5
		});
	}
}
